Replication Data for:
"Who Should Politicians Represent? How Winning an Election Influences Citizens' Views on Representation" (The Journal of Politics; 2025)
Tim Lars Allinger

*** General ***

The code was run with R (version 4.4.2). 

The replication package includes four folders:

	1) 'code': The code for the replication.
	2) 'data_coded': Pre-processed data sets for replicating the tables and figures.
	3) 'plots': Folder which the figures are exported to.
	4) 'raw_data': Raw data files and shapefiles of the German electoral districts.


Furthermore, it includes the an R Project file "replication.Rproj". 

To make sure that the code works properly, please download the full replication package, and locate all files in a new folder. The directory of this folder should then be set as working directory in R. The easiest way to do so is by opening the R Project "replication.Rproj", and then running all the replication within this project.



*** Data & Code ***

### Downloading and preprocessing the data the data 
The first step for replicating the findings is to preprocess the data. The code "preprocessing.R" can be found in the 'code' folder. GESIS does not allow sharing the GLES survey data, however it can be downloaded for free from the GESIS webpage. Therefore, please follow the following steps described below. 

For the code to run properly, please make sure to follow these steps in advance:

	- Download the "GLES Cross-Section 2009-2021, Cumulation (ZA6835)" data set (dta version) from the GESIS website (login required). You can find it here: https://search.gesis.org/research_data/ZA6835
	  Then place the following file in the 'raw_data' folder:
		* "ZA6835_v2-0-0.dta"

	- Make sure the following files are located n the 'raw_data folder: (included in the replication package)
		* "results_2013.csv": Official election results for the 2013 national election
		* "results_2017.csv": Official election results for the 2017 national election
		* "results_2021.csv": Official election results for the 2021 national election

Once you have done this, you should find the preprocessed data for the analysis in the 'data_coded' folder. 



### Analysis 

The code for replicating figures and tables is "analysis.R", which you can find in the 'code' folder.

For the code to run properly, please make sure that the following datasets are placed in the respective folders:

	- Folder: 'data_coded'
		* "districts_results.csv": The results of the district races in the three German national elections in 2013, 2017, and 2021. (included in the replication package)
		* "survey_data.csv": Preprocessed survey data from the German Longitudinal Election Study (GLES), including both pre- and post-election waves, as well as information on the election results in the respondents' districts. (generated by following the steps described above)
	
	- Folder: 'raw_data'
		* 'btw13_geometrie_wahlkreise_shp': Folder containing shapefiles of electoral districts in the 2013 national election (included in the replication package)
		* 'btw17_geometrie_wahlkreise_shp': Folder containing shapefiles of electoral districts in the 2017 national election (included in the replication package)
		* 'btw21_geometrie_wahlkreise_shp': Folder containing shapefiles of electoral districts in the 2021 national election (included in the replication package)

The produced figures will be stored in the 'plots' folder.


 

*** Other documents ***

This replication package includes two additional documents:

1) readme.txt: Readme file.
2) codebook.pdf: Codebook for the variables used in the analysis.
